var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    }; Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("AudioManager"),
    i = e("Game"),
    r = e("ObjectPool"),
    s = cc._decorator,
    l = s.ccclass,
    _ = s.property,
    c = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.level_up_ske = null),
                (t.role_buff_ske = null),
                (t.birth_light_ske = null),
                (t.home_heal_ske = null),
                (t.sprint_node = null),
                (t.coin_system = null),
                (t.role_effects_ske = null),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.showEffectInfo = function (e) {
                var t = this;
                switch (
                (this.unscheduleAllCallbacks(),
                    (this.node.active = !0),
                    (this.node.y = 0),
                    (this.node.scale = 1),
                    e)
                ) {
                    case i.RoleEffectType.level_up:
                        this.showLevelUpEffect();
                        break;
                    case i.RoleEffectType.my_birth_light:
                        (this.birth_light_ske.defaultSkin = "green"),
                            n.default.getInstance().playFx("my_birth"),
                            this.showBirthLightEffect();
                        break;
                    case i.RoleEffectType.other_birth_light:
                        (this.birth_light_ske.defaultSkin = "blue"), this.showBirthLightEffect();
                        break;
                    case i.RoleEffectType.blue_buff:
                        (this.node.zIndex = 1),
                            (this.role_buff_ske.node.active = !0),
                            this.role_buff_ske.setAnimation(0, "buff_l", !0),
                            this.scheduleOnce(function () {
                                t.disEffectNode();
                            }, 40);
                        break;
                    case i.RoleEffectType.red_buff:
                        (this.node.zIndex = 2),
                            (this.role_buff_ske.node.active = !0),
                            this.role_buff_ske.setAnimation(0, "buff_h", !0),
                            this.scheduleOnce(function () {
                                t.disEffectNode();
                            }, 40);
                        break;
                    case i.RoleEffectType.dragon_buff:
                        (this.node.zIndex = 3),
                            (this.role_buff_ske.node.active = !0),
                            this.role_buff_ske.setAnimation(0, "buff_dl", !0),
                            this.scheduleOnce(function () {
                                t.disEffectNode();
                            }, 60);
                        break;
                    case i.RoleEffectType.home_heal:
                        (this.node.zIndex = 6),
                            (this.home_heal_ske.node.active = !0),
                            this.home_heal_ske.setAnimation(0, "animation", !0);
                        break;
                    case i.RoleEffectType.kill:
                        (this.node.y += 100), (this.node.scale = 2), this.operateAnime("zs");
                        break;
                    case i.RoleEffectType.heal:
                        this.operateAnime("zl");
                        break;
                    case i.RoleEffectType.fill:
                        this.operateAnime("dr", !0, 5);
                        break;
                    case i.RoleEffectType.clock:
                        this.operateAnime("zz");
                        break;
                    case i.RoleEffectType.sprint:
                        (this.node.zIndex = 3),
                            (this.node.active = !0),
                            (this.sprint_node.active = !0),
                            this.sprint_node.getComponent(cc.ParticleSystem).resetSystem(),
                            (this.node.scaleX = -1),
                            this.scheduleOnce(function () {
                                (t.sprint_node.active = !1), t.disEffectNode();
                            }, 5);
                        break;
                    case i.RoleEffectType.coin:
                        (this.node.zIndex = 7),
                            (this.coin_system.node.active = !0),
                            n.default.getInstance().playFx("bome_coin"),
                            this.coin_system.resetSystem(),
                            this.scheduleOnce(function () {
                                (t.coin_system.node.active = !1), t.disEffectNode();
                            }, 1);
                        break;
                    case i.RoleEffectType.Operate:
                        this.operateAnime("hr");
                        break;
                    case i.RoleEffectType.get_equip:
                        (this.node.y += 50), this.operateAnime("gx");
                        break;
                    case i.RoleEffectType.tower_hit:
                        (this.node.y += 100), (this.node.scale = 2), this.operateAnime("fytsj");
                        break;
                    case i.RoleEffectType.hero_die:
                        this.operateAnime("sw");
                }
            }),
            (t.prototype.operateAnime = function (e, t, o) {
                var a = this;
                void 0 === t && (t = !1),
                    void 0 === o && (o = 0),
                    (this.node.zIndex = 5),
                    (this.role_effects_ske.node.active = !0),
                    this.role_effects_ske.setAnimation(0, e, t),
                    t
                        ? this.scheduleOnce(function () {
                            (a.role_effects_ske.node.active = !1), a.disEffectNode();
                        }, o)
                        : this.role_effects_ske.setCompleteListener(function () {
                            a.role_effects_ske.setCompleteListener(null),
                                (a.role_effects_ske.node.active = !1),
                                a.disEffectNode();
                        });
            }),
            (t.prototype.showLevelUpEffect = function () {
                var e = this;
                (this.node.zIndex = 5),
                    (this.level_up_ske.node.active = !0),
                    this.level_up_ske.setAnimation(0, "levelup", !1),
                    (this.level_up_ske.timeScale = 0.8),
                    this.level_up_ske.setCompleteListener(function () {
                        e.disEffectNode();
                    });
            }),
            (t.prototype.showBirthLightEffect = function () {
                var e = this;
                (this.node.zIndex = 0),
                    (this.birth_light_ske.node.active = !0),
                    this.birth_light_ske.setAnimation(0, "birth", !1),
                    this.birth_light_ske.setCompleteListener(function () {
                        e.disEffectNode();
                    });
            }),
            (t.prototype.disEffectNode = function () {
                for (var e = 0, t = this.node.children; e < t.length; e++) t[e].active = !1;
                r.default.getInstance().Recovey(this.node, i.Pool_Type.role_effects);
            }),
            oo([_(sp.Skeleton)], t.prototype, "level_up_ske", void 0),
            oo([_(sp.Skeleton)], t.prototype, "role_buff_ske", void 0),
            oo([_(sp.Skeleton)], t.prototype, "birth_light_ske", void 0),
            oo([_(sp.Skeleton)], t.prototype, "home_heal_ske", void 0),
            oo([_(cc.Node)], t.prototype, "sprint_node", void 0),
            oo([_(cc.ParticleSystem)], t.prototype, "coin_system", void 0),
            oo([_(sp.Skeleton)], t.prototype, "role_effects_ske", void 0),
            oo([l], t)
        );
    })(a.default);
o.default = c;
